package com.mycompany.project.server;

import java.rmi.RemoteException; 

import ws.CoordenadaSOAProxy;
import ws.LogSOAProxy;

import com.google.gwt.user.server.rpc.RemoteServiceServlet;
import com.mycompany.project.client.SOAService;


public class SOAServiceImpl extends RemoteServiceServlet implements SOAService {

	private static final long serialVersionUID = 1L;

	public String validarCoordenada(String encriptadoCoord) {
		
		String salida;
		
		CoordenadaSOAProxy coorde = new CoordenadaSOAProxy(); 
		
		try {
			salida = coorde.validarCoordenada(encriptadoCoord);
		} catch (RemoteException e) {
			// TODO Auto-generated catch block
			salida = "Error";
			e.printStackTrace();
		}
		
		return salida;
		// TODO Auto-generated method stub
		
	}

	@Override
	public String generarClave() {
		
		String salida;
		
		CoordenadaSOAProxy coorde = new CoordenadaSOAProxy();
		
		try {
			salida = coorde.generarClave();
		} catch (RemoteException e) {
			// TODO Auto-generated catch block
			salida = "Error";
			e.printStackTrace();
		}
		
		return salida;
		
	}

	@Override
	public String ingresarLog(String json) {

		String salida;
		
		LogSOAProxy log = new LogSOAProxy(); 
		
		try {
			salida = log.ingresarLog(json);
		} catch (RemoteException e) {
			// TODO Auto-generated catch block
			salida = "Error";
			e.printStackTrace();
		}
		return salida;
	}

	@Override
	public String verLog() {
		
		String salida;
		
		LogSOAProxy log = new LogSOAProxy(); 
	//	Type collectionType = new TypeToken<ArrayList<PersonaSOAPVO>>(){}.getType();
	//	Collection<PersonaSOAPVO> ejemplo = gson.fromJson(mostrarPers, collectionType);
		
		try {
			salida = log.verLog();
		} catch (RemoteException e) {
			salida = "Error";
			e.printStackTrace();
		}
		return salida;
		
	}

	@Override
	public String find(String run) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public String findAll(String Text) {
		// TODO Auto-generated method stub
		return null;
	}

}